<!--学生查看通知详情-->

<link rel="stylesheet" href="./css/lookinform.css">

<div id="body_div">

</div>

<script>
	scroll(0, 0);

	$.ajax({
		xhrFields: {
			withCredentials: true
		},
		type: "get",
		url: getFullURL("sel-inform"),
		dataType: 'json',
		data: {
			iid: $.session.get('iid')
		},
		success: function(data) {
			console.log(data);
			var str = `
                	<h3 class="text-left text-h3">` + data.inform.title + `</h3>
                	<h4 class="text-h4">` + timeStamp2String(data.inform.createTime) + `&emsp;` + data.inform.school.sname + `</h4>
                    <div class="main">` + data.inform.content + `</div>
                    <div class="text-right" id="button_div">
                        <button type="button" class="btn btn-primary" id="cancel">返&emsp;回</button>
                    </div>
                `;

			$('#body_div').append(str);

			$('#cancel').click(function() {
				$('.center').html('');
				$('.center').load('./message.html');
			})
		},
		error: function(err) {
			alert("请求异常，请重新登录！", function() {
				$(location).attr('href', './login.html');
			})
		}
	})

	function timeStamp2String(time) {
		var datetime = new Date();
		datetime.setTime(time);
		var year = datetime.getFullYear();
		var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
		var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
		var hour = datetime.getHours() < 10 ? "0" + datetime.getHours() : datetime.getHours();
		var minute = datetime.getMinutes() < 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
		var second = datetime.getSeconds() < 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
		return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
	}
</script>